
const Path = require('path');
const fs = require('fs');
const yoyosqlite = require('yoyosqlite');

const database = require('../config/database');

let newPath = Path.resolve(database.sqlite);
let par = Path.parse(newPath);
if(!fs.existsSync(par.dir)){
    fs.mkdirSync(par.dir, { recursive: true });//创建目录
}
const sqlite = yoyosqlite(newPath);
// sqlite.isShowSql = true;//你可以调试的时候显示sql语句
global.DB = sqlite;